class TIMERUP extends egret.DisplayObjectContainer {
	private static TIMER:TIMERUP;
    framptr:Object[]=[]
	framfunc:string[]=[]
	//以下是为了编辑器扩展
	touchptr:Object[]=[]
	touchfunc:string[]=[]
	//************************* */
	private constructor() {
		super();
		//this.addEventListener(egret.Event.ENTER_FRAME,this.update,this);
	}
	public static get gettimercontrl():TIMERUP
	{
       if(this.TIMER==undefined)this.TIMER=new TIMERUP
	   return this.TIMER;
	}
	public addFrameEvent(ptr:Object,func:string)
	{
       this.framptr.push(ptr)
	   this.framfunc.push(func)
	}
	public addTouchEvent(ptr:Object,func:string)
	{
       this.touchptr.push(ptr)
	   this.touchfunc.push(func)
	}
	public removetouchevent(ptr:Object,func:string)
	{
		for(let a=0;a<this.touchptr.length;a++)
	   {
		   if(this.touchptr[a]==ptr&&this.touchfunc[a]==func)
		   {
			   this.touchptr.splice(a,1)
			   this.touchfunc.splice(a,1)
		   }
	   }
	}
	public removeframeevent(ptr:Object,func:string)
	{
		for(let a=0;a<this.framptr.length;a++)
	   {
		   if(this.framptr[a]==ptr&&this.framfunc[a]==func)
		   {
			   this.framptr.splice(a,1)
			   this.framfunc.splice(a,1)
		   }
	   }
	}
	public  update()
	{
	   CBASE_MANAGE.getCBASE_MANAGE.update()
	   COLLISION_MANAGE.getCOLLISIONCONTRL.ALL_collision()
       for(let a=0;a<this.framptr.length;a++)
	   {
		  this.framptr[a][this.framfunc[a]]()
	   }
	}
	//以下是为编辑器扩展
	public  touchevent(e:egret.TouchEvent)
    {
       for(let a=0;a<this.touchptr.length;a++)
	   {
		   this.touchptr[a][this.touchfunc[a]](e)
	   }
	}
	public timerstop()
	{
		this.removeEventListener(egret.Event.ENTER_FRAME,this.update,this);
	}
	public timerbegin()
	{
		this.addEventListener(egret.Event.ENTER_FRAME,this.update,this);
	}
	public touchstop()
	{
        egret.MainContext.instance.stage.removeEventListener(egret.TouchEvent.TOUCH_BEGIN,this.touchevent,this);
		egret.MainContext.instance.stage.removeEventListener(egret.TouchEvent.TOUCH_END,this.touchevent,this);
		egret.MainContext.instance.stage.removeEventListener(egret.TouchEvent.TOUCH_MOVE,this.touchevent,this);
		egret.MainContext.instance.stage.removeEventListener(egret.TouchEvent.TOUCH_CANCEL,this.touchevent,this);
		egret.MainContext.instance.stage.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.touchevent,this);
	}
	public touchbegin()
	{
		egret.MainContext.instance.stage.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.touchevent,this);
		egret.MainContext.instance.stage.addEventListener(egret.TouchEvent.TOUCH_END,this.touchevent,this);
		egret.MainContext.instance.stage.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.touchevent,this);
		egret.MainContext.instance.stage.addEventListener(egret.TouchEvent.TOUCH_CANCEL,this.touchevent,this);
		egret.MainContext.instance.stage.addEventListener(egret.TouchEvent.TOUCH_TAP,this.touchevent,this);
	}

}